package org.blogwu.learn.multithread.chapter3.demo17;

import java.util.concurrent.*;

public class CallBackMain {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        ExecutorService e = Executors.newFixedThreadPool(5);
        Future<String> fu = e.submit(new CallBackThread());
        System.out.println("已提交");
        String res = fu.get();
        System.out.println(res);
    }

    static class CallBackThread implements Callable<String> {

        @Override
        public String call() throws Exception {
            System.out.println("开始运行-----");
            Thread.sleep(3000);

            return "Hello";
        }
    }
}


